fix: Require at least one alphanumeric char in workspace name#9263
Conversation
`COMPANY_NAME_REGEX` blocks disallowed chars but accepts symbol-only strings like `-_________-` since `-` and `_` are in the allowed set. Add `HAS_ALPHANUMERIC_REGEX` and check it in `validateWorkspaceName` and `validateCompanyName` so inputs with no letter or digit are rejected. Fixes makeplane#9255 Signed-off-by: okxint <cashmein.eth@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds a new exported regex constant ChangesAlphanumeric validation for company and workspace names
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…9278) * fix(api): require at least one alphanumeric char in workspace name Workspace name validation was enforced only on the frontend (validateWorkspaceName), which gates the UI submit but is bypassable via a direct API call. The backend WorkSpaceSerializer.validate_name only rejected URLs, so a symbol-only name like "-_________-" could still be saved via create or the rename (partial_update) path. Add a Unicode-aware has_alphanumeric() helper and enforce it in both the app and instance/license workspace serializers, mirroring the frontend HAS_ALPHANUMERIC_REGEX (/[\p{L}\p{N}]/u) added in #9263. International names (日本語, José, محمد) still pass since str.isalnum() covers all scripts. Adds unit tests covering symbol-only rejection and international acceptance on both serializers. Refs #9255 Signed-off-by: sriramveeraghanta <veeraghanta.sriram@gmail.com> * fix(api): reject URLs in instance workspace name for parity Address CodeRabbit review on #9278: the instance/license WorkspaceSerializer.validate_name rejected symbol-only names but, unlike the app-level WorkSpaceSerializer, still accepted names containing URLs. Add the same contains_url() guard (imported from plane.utils.url, not content_validator) so both workspace-create paths validate identically. Add unit tests asserting URL-containing names are rejected on both serializers. Signed-off-by: sriramveeraghanta <veeraghanta.sriram@gmail.com> --------- Signed-off-by: sriramveeraghanta <veeraghanta.sriram@gmail.com>
…cope + workspace-name валидация + Storybook v10) upstream makeplane#9269/makeplane#9270 (scope issue-ID/cascade-delete к workspace в bulk-эндпоинтах), makeplane#9263/makeplane#9278 (workspace name ≥1 буквенно-цифровой), makeplane#9277 (Storybook v10). Конфликт sub_issue.py разрешён объединением: eyriehq validate_sub_issues_bulk + upstream workspace__slug-scope. Наш GraphQL-шлюз уже безопасен (мутации ре-парента scope по project=p), поддержка не нужна. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
COMPANY_NAME_REGEXonly blocks disallowed characters — it never checks that the name actually contains a letter or digit. So names like-_________-or---pass validation cleanly.Added a second check using
\p{L}\p{N}(Unicode-aware) in bothvalidateCompanyNameandvalidateWorkspaceName. International names (Japanese, Arabic, accented chars) still pass fine since\p{L}covers all Unicode letters.Closes #9255
Summary by CodeRabbit